/**
 * 
 */
package com.oolong.account.dal;

import java.util.Date;
import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.oolong.account.vo.DateStaticVo;
import com.oolong.account.vo.MonthStaticVo;
import com.oolong.account.vo.TotalStaticVo;

/**
 * @author rong.zhang
 * 
 */
public class StaticDAOImpl extends SqlMapClientDaoSupport implements StaticDAO {

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.oolong.account.dal.StaticDAO#selectBybtwday(java.lang.Integer,
	 * java.util.Date, java.util.Date)
	 */
	@Override
	public List<DateStaticVo> selectBybtwday(Integer user_id, Date startday,
			Date endday) {
		DateStaticVo dateStaticVo = new DateStaticVo();
		dateStaticVo.setUser_id(user_id);
		dateStaticVo.setStartday(startday);
		dateStaticVo.setEndday(endday);
		return getSqlMapClientTemplate().queryForList("static.selectBybtwday",
				dateStaticVo);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.oolong.account.dal.StaticDAO#selectByday(java.lang.Integer)
	 */
	@Override
	public List<DateStaticVo> selectByday(Integer user_id) {
		DateStaticVo dateStaticVo = new DateStaticVo();
		dateStaticVo.setUser_id(user_id);
		return getSqlMapClientTemplate().queryForList("static.selectByday",
				dateStaticVo);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.oolong.account.dal.StaticDAO#selectbymonth(java.lang.Integer)
	 */
	@Override
	public List<MonthStaticVo> selectbymonth(Integer user_id) {
		MonthStaticVo monthStaticVo = new MonthStaticVo();
		monthStaticVo.setUser_id(user_id);
		return getSqlMapClientTemplate().queryForList("static.selectbymonth",
				monthStaticVo);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.oolong.account.dal.StaticDAO#selecttotallast(java.lang.Integer)
	 */
	@Override
	public TotalStaticVo selecttotallast(Integer user_id) {
		TotalStaticVo totalStaticVo = new TotalStaticVo();
		totalStaticVo.setUser_id(user_id);
		return (TotalStaticVo) getSqlMapClientTemplate().queryForObject(
				"static.selecttotallast", totalStaticVo);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.oolong.account.dal.StaticDAO#selectTypeBybtwday(java.lang.Integer,
	 * java.util.Date, java.util.Date)
	 */
	@Override
	public List<DateStaticVo> selectTypeBybtwday(Integer user_id,
			Date startday, Date endday) {
		DateStaticVo dateStaticVo = new DateStaticVo();
		dateStaticVo.setUser_id(user_id);
		dateStaticVo.setStartday(startday);
		dateStaticVo.setEndday(endday);
		return getSqlMapClientTemplate().queryForList(
				"static.selecttypeBybtwday", dateStaticVo);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.oolong.account.dal.StaticDAO#selectbyOnemonth(java.lang.Integer,
	 * java.lang.Integer)
	 */
	@Override
	public MonthStaticVo selectbyOnemonth(Integer user_id, String month) {
		MonthStaticVo monthStaticVo = new MonthStaticVo();
		monthStaticVo.setUser_id(user_id);
		monthStaticVo.setMonth(month);
		return (MonthStaticVo) getSqlMapClientTemplate().queryForObject(
				"static.selectbyOnemonth", monthStaticVo);
	}
}
